package com.gusha.model;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name="processing_order")
@NamedQuery(name="ProcessingOrder.findAll", query="SELECT s FROM ProcessingOrder s")
@DynamicInsert
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProcessingOrder implements Serializable {
	 private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private BigInteger id;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="user_id")
    private User userId;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="processing_id")
    private SysProcessing processingId; // 加工产品ID
	
	@Column(name="buy_num")
	private BigInteger buyNum;// 购买数量
	
	@Column(name="state")
	private BigInteger state;// 0:未购买 1:已购买
	
	@Column(name = "add_time")
	private java.util.Date addTime;// 购买时间

	public BigInteger getId() {
		return id;
	}

	public void setId(BigInteger id) {
		this.id = id;
	}

	public User getUserId() {
		return userId;
	}

	public void setUserId(User userId) {
		this.userId = userId;
	}

	public SysProcessing getProcessingId() {
		return processingId;
	}

	public void setProcessingId(SysProcessing processingId) {
		this.processingId = processingId;
	}

	public BigInteger getBuyNum() {
		return buyNum;
	}

	public void setBuyNum(BigInteger buyNum) {
		this.buyNum = buyNum;
	}

	public BigInteger getState() {
		return state;
	}

	public void setState(BigInteger state) {
		this.state = state;
	}

	public java.util.Date getAddTime() {
		return addTime;
	}

	public void setAddTime(java.util.Date addTime) {
		this.addTime = addTime;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
}
